﻿<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@page import="global.Constants"%>
    <%@page import="util.ServletHelp"%>
 <%@page import="com.aiflow.Action.DepartmentAction"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
	<%
	
		String baseUrl = request.getContextPath();
 
	%>
	<script type="text/javascript">
	    //这里的全局是为了修改之后的刷新
	    var callStreamListGrid;
	    var callStreamListStore;
		$(document).ready(function(){
			 // 全局参数
			var baseParams = {limit:<%=Constants.PAGE_SIZE %>,start : 0};
			var EXT_QUERY_TIME_OUT = 1200000;
     
		   

			// 传报数据源  userName,u.telep ,d.name as targetName
		    callStreamListStore = new Ext.data.JsonStore({
		        url: '${pageContext.request.contextPath}/callStream_findCallStream.action',
		        root: 'datas',
				timeout : EXT_QUERY_TIME_OUT,
		        totalProperty: 'results',
		        fields: ['id','alarmId','MVB_CALLER','userName','tel','name','sendTime','calltime','answertime','endtime','duration' ],
		        baseParams: baseParams,
		        autoLoad: true,
				listeners : {  
          load : function() {  
              isDetailReady = true;// 查询置换标志为已查过   
            }  
            }  
		    });
		    
		
			

			  
		
		 
				   	    // 工具栏
		   var callStreamListToolbar = new Ext.Toolbar({
		    	renderTo: 'callStreamListToolBarDiv',
		    	items: [
					
		             new Ext.Button({
					    id: 'callStream-down-button',
					    text: '导出',
						iconCls: 'page_white_excel'
						
					}),
					'-','查询： 日期',' 起',
					{  
			                xtype:'datefield',
			                id:'callstartTime',
			                hiddenName: 'startTime',
			                fieldLabel: '开始',
                            format:'Y-m-d',
			                mode : 'local',
			                triggerAction: "all",
			                allowBlank:true,
			                editable: false,
			                width: 110,
			                anchor:'98%',
			                endDateField : 'callendTime'
			           },' 止 ',
			           {  
			                xtype:'datefield',
			                id:'callendTime',
			                hiddenName: 'endTime',
			                fieldLabel: '开始',
                            format:'Y-m-d',
			                mode : 'local',
			                triggerAction: "all",
			                allowBlank:true,
			                editable: false,
			                width: 110,
			                anchor:'98%',
			                startDateField : 'callstartTime'
			           },'  电话号码',
			          {// 账号
			                id:'tele',
			                xtype:'textfield',
			                name: 'tele',
			                fieldLabel: '手机',
			                anchor:'98%',
			                allowBlank:false,
			                maxLength: 20
			           },
			              
			                '-',
		             new Ext.Button({
					    id: 'callStream-query-button',
					    text: '查询',
						iconCls: 'magnifier'
						
					})
				]
			});
 
			// 数据表格    dept_name spec
			var sm = new Ext.grid.CheckboxSelectionModel();
			callStreamListGrid = new Ext.grid.EditorGridPanel({
				id: 'callStreamListGrid',
				renderTo: 'callStreamListGridDiv',
				border: false,
				stateful: true,
			    autoScroll: 'auto',
		        store: callStreamListStore,
		        loadMask: true,
		        cm: new Ext.grid.ColumnModel({
		            defaults: {
		                width: 100,
		                sortable: true
		            },
			        columns: [   //id,Alarm_id,Region_name,Alarm_pro,Dn,Dn_type,Alarm_time,Org_severity
						sm,
						new Ext.grid.RowNumberer({header:'№',width:20}),

						{id:'alarmId',header: '告警编号', width: 100, hidden: false, sortable: true , dataIndex: 'alarmId'},
			            {id:'MVB_CALLER',header: 'MVB_CALLER', width: 110,hidden: false, sortable: true, dataIndex: 'MVB_CALLER'},
			            {id:'userName',header: '传报人', width: 150,hidden: false, sortable: true, dataIndex: 'userName'},
			            {id:'tel',header: '电话', width: 100,hidden: false, sortable: true, dataIndex: 'tel'},
			            {id:'name',header: '传报对象', width: 120,hidden: false, sortable: true, dataIndex: 'name'},
                        {id:'sendTime',header: '发送时间', width: 120,hidden: false, sortable: true, dataIndex: 'sendTime'},
			            {id:'calltime',header: '呼叫时间', width:120,hidden: false, sortable: true, dataIndex: 'calltime'},
			            {id:'answertime',header: '应答时间', width:120,hidden: false, sortable: true, dataIndex: 'answertime'},
                        {id:'endtime',header: '结束时间', width:120,hidden: false, sortable: true, dataIndex: 'endtime'},
                        {id:'duration',header: '通话时长(秒)', width:120,hidden: false, sortable: true, dataIndex: 'duration'}
                        ]
		        }),
		        sm: sm,
		        columnLines: true,
		         bbar: new Ext.PagingToolbar({
					pageSize: <%=Constants.PAGE_SIZE %>,
					store: callStreamListStore,
					displayInfo: true,
					displayMsg: Anynote.PAGINGTOOLBAR_DISPLAYMSG,
					emptyMsg: Anynote.PAGINGTOOLBAR_EMPTYMSG,
					doLoad: function(start){
						baseParams.start = start;
						this.store.load({params: baseParams});
					}
		        })
		      
		    });
		    
		    
		    

			// 设置Grid高度和宽度
		    Anynote.resizeGridTo("callStreamListGrid", 0, 56);
			 
			 
		    // 类型ComboBox设值  
 
			
		})  
           
           
        



			
			 $("#callStream-query-button").click(function(){
			
			   var startTime = Ext.getCmp("callstartTime").getValue();
			   var endTime = Ext.getCmp("callendTime").getValue();
			    
			   var backComm = Ext.getCmp("tele").getValue(); 
			  
			     var basePar  = {limit:<%=Constants.PAGE_SIZE %>,start : 0};
			       basePar.startTime = startTime;
			       basePar.endTime = endTime;
			       basePar.backCom = backComm;
			    callStreamListStore.reload({params:basePar});
			 })
		
				 
					     
					     
				  $("#callStream-down-button").click(function(){   //   下载 
				 var startTime = Ext.getCmp("callstartTime").getValue();
			     var endTime = Ext.getCmp("callendTime").getValue();
			     var backCom = Ext.getCmp("tele").getValue();
			        window.location.href = "${pageContext.request.contextPath}/callStream_down.action?startTime="+startTime+"&endTime="+endTime+"&tele="+backCom;
				  })
				  
				  
				  
	  
	</script>
</head>
<body>
<div id="callStreamListDiv">
	<div id="callStreamListToolBarDiv"></div>
	<div id="callStreamListGridDiv" style="width:100%;height:100%;"></div>
</div>
</body>
</html>